load FAMPanes,TagBlock,ResetTabs

! -------------- Start Template -----------------
DropTypes INDI,INDICtrl
GoSub ResetTabs,0
GoSub FAMPanes,"Media"

! To omit duplicates
#objeList=""
#numOBJE=@countAll.OBJE
#numRootOBJE=@count.OBJE

! --------- OBJEs -----------
cell GroupBox,local("Multimedia")
  width -1
  newline
  if OBJE is here || SOUR is here
    Gosub TagBlock,"OBJE","Multimedia"
    ShowAll SOUR,"Media"
    newline
  else
    newline -#lineSkip-3
  endif
  Show OBJE
EndGroup

! --------- Other Multimedia
if #numOBJE>#numRootOBJE
  cell GroupBox,local("Event Multimedia")
    width -1
    newline
    #startVH=#vpos$+#hpos$
    ShowAll FAMEvntsOrdns "Media"
    if #startVH=#vpos$+#hpos$
      Newline -6
      cell static,local("None")
      sizetofit
    endif
    
    ! Check for duplcates
    Words "#numUnique",1,0,#objeList
    #dups=#numOBJE-#numUnique[0]
    if #dups>0
      newline
      if #dups=1
        cell static,local("One duplicate was skipped")
      else
        cell static,#dups&" "&local("duplicates were skipped")
      endif
      sizetofit
    endif
  EndGroup
endif

hideexcess
